<?php if (!defined('SERVER_ROOT')) {exit('No direct script access allowed');}
//header
$this->template->title = 'Danh mục cán bộ';
$this->template->display('dsp_header.php');
?>
 <form name="frmMain" id="frmMain" action="" method="POST">
    <?php
    echo $this->hidden('controller',$this->get_controller_url());
    echo $this->hidden('hdn_item_id','0');
    echo $this->hidden('hdn_item_id_list','');
    echo $this->hidden('hdn_dsp_single_method','dsp_single_canbo');
    echo $this->hidden('hdn_dsp_all_method','dsp_all_canbo');
    echo $this->hidden('hdn_update_method','update_canbo');
    echo $this->hidden('hdn_delete_method','delete_canbo');
    echo $this->hidden('hdn_TYPE_filter', 'MA_DON_VI');
    $v_row = 0;
    ?>
    <h3 style="text-align:center;text-transform: uppercase">DANH SÁCH CÁN BỘ CHƯA PHÂN NƠI CÔNG TÁC</h3>
    <div id="div_filter">
        <input class = 'button' type="button" name="btn_add_canbo" value="Thêm cán bộ" onclick="location.href='<?php echo SITE_ROOT . 'qlcb/canbo/dsp_single_canbo/&m=0'?>'"/>
        <input type="button" name="update" class = 'button' value="Danh sách cán bộ" onclick="location.href='<?php echo SITE_ROOT . 'qlcb/canbo/'?>'"/>
	</div>
    <table  width="100%" class="adminlist" cellspacing="0" border="1">
        <colgroup>
            <col width="40%" />
            <col width="20%" />
            <col width="6%" />
            <col width="8%" />
            <col width="26%" />
        </colgroup>
        <tr>
            <th>Tên cán bộ</th>
            <th>Tài khoản</th>
            <th>Thứ tự</th>
            <th>Trạng thái</th>
            <th>Thao tác</th>
        </tr>
         <?php while ($arr = $arr_all_canbo->FetchRow()): ?>
            <?php
             $MA_CAN_BO=$arr['MA_CAN_BO'];
             $TEN_CAN_BO=$arr['TEN_CAN_BO'];
             $STT_CAN_BO=$arr['STT_CAN_BO'];
             $TEN_TRANG_THAI=$arr['TEN_TRANG_THAI'];
             $TAI_KHOAN = $arr['TAI_KHOAN'];
             $v_class = 'row' . ($v_row % 2);
             $v_row++;
             $v_link = SITE_ROOT . 'qlcb/canbo/dsp_single_canbo/&m=' . $MA_CAN_BO;
            ?>
            <tr class="<?php echo $v_class;?>">
                <td>
                    <a href="<?php echo $v_link;?>">
                            <?php echo $TEN_CAN_BO;?>
                    </a>
                </td>
                <td><?php echo $TAI_KHOAN;?></td>
                <td style="text-align:center"><?php echo $STT_CAN_BO;?></td>
                <td style="text-align:center"><?php echo $TEN_TRANG_THAI;?></td>
                <td style="text-align:center">
                    <a href="javascript:void(0)" onclick="themnoicongtac_onclick('<?php echo $MA_CAN_BO;?>')">Cập nhật công tác</a> |
                    <a href="javascript:void(0)" onclick="qtct_canbo_click('<?php echo $MA_CAN_BO;?>')">Quá trình công tác</a> |
                    <a href="javascript:void(0)" onclick="quick_delete_canbo('<?php echo $MA_CAN_BO;?>')">Xoá</a>
                </td>
            </tr>
        <?php endwhile; ?>
        <?php echo $this->add_empty_rows($v_row +1, _CONST_DEFAULT_ROWS_PER_PAGE, 5); ?>
    </table>

</form>
<script>
    function themnoicongtac_onclick(macanbo) {
          var url = '<?php echo $this->get_controller_url(); ?>dsp_themnoicongtac/' + macanbo
          url += '/?&macanbo=' + macanbo + '&pop_win=1';
          showPopWin(url, 450, 220, null);
      }
    function qtct_canbo_click(macanbo){
        var url = '<?php echo $this->get_controller_url();?>dsp_all_to_of_canbo/' + macanbo
            url += '/?&macanbo=' + macanbo + '&pop_win=1';
        showPopWin(url ,700,350, null);
    }
    function quick_delete_canbo(macanbo)
    {
        var f = document.frmMain;
        if (confirm('Bạn chắc chắn xoá đối tượng đã chọn?')){
            f.hdn_item_id.value =  macanbo;
            m = $("#controller").val() + 'delete_canbo'
            $("#frmMain").attr("action", m);
            f.submit();
        }
    }

</script>
<?php $this->template->display('dsp_footer.php');